Grid10

A = (4.139042219725586, 3.1662421427699456)
B = (4.527973594522791, 3.341888570097716)
dAB = Distance(A, B)
θ = If(x(A) ≠ x(B), atan(Slope[Line[A, B]]), If[x(A) ≟ x(B) ∧ (y(B) > y(A)), 1.5707963267948966, If[x(A) ≟ x(B) ∧ (y(B) < y(A)), -1.5707963267948966]])
m = 4 (slider from 0 to 10, step 1)
n = 3 (slider from 0 to 10, step 1)
a = Segment(A, B)
e_m = 5 (slider from 1 to 10, step 1)
e_n = 2 (slider from 1 to 10, step 1)
GridAllParallelABsegments = Sequence(Segment[(x(A) - n * dAB * cos(θ) - i * dAB * sin(θ), y(A) - n * dAB * sin(θ) + i * dAB * cos(θ)), (x(A) + n * dAB * cos(θ) - i * dAB * sin(θ), y(A) + n * dAB * sin(θ) + i * dAB * cos(θ))], i, -m, m, 1 / e_m)
GridAllPerpABsegments = Sequence(Segment[(x(A) + j * dAB * cos(θ) - m * dAB * sin(θ), y(A) + j * dAB * sin(θ) + m * dAB * cos(θ)), (x(A) + j * dAB * cos(θ) + m * dAB * sin(θ), y(A) + j * dAB * sin(θ) - m * dAB * cos(θ))], j, -n, n, 1 / e_n)